﻿var urlSuffix = '.aspx';

function FillPicture(urlPath, idOfDiv, folderImagePath, folderThumbPath, fileName, funcNum) {
    var param = {
        FolderImagesPath: folderImagePath,
        FolderThumbsPath: folderThumbPath,
        FileName: fileName,
        CKEditorFuncNum: funcNum
    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath + urlSuffix,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfDiv).html(result.toString());
        },
        error: function () {
            ////alert("ajax has error");
        }
    });
}

function GetAjaxToDiv(urlPath, idOfDiv) {
    $.ajax({
        type: "POST",
        url: urlPath + urlSuffix,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfDiv).html(result.toString());
        },
        error: function () {
            //alert("ajax has error");
        }
    });
}

function FillInfoBaseId(urlPath, idOfDiv, idOfItem) {
    $.ajax({
        type: "POST",
        data: idOfItem,
        url: urlPath + urlSuffix,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfDiv).html(result.toString());
        },
        error: function () {
            ////alert("ajax has error");
        }
    });
}

function FillContentBaseIndex(urlPath, idOfContentContainerDiv, idOfItem, index, culture) {
    var param = {
        Id: idOfItem,
        IntParam: index,
        StrParam: culture
    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath + urlSuffix,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfContentContainerDiv).html(result.toString());
        },
        error: function () {
            ////alert("ajax has error");
        }
    });
}

function Views(urlPath, idOfDiv, id) {
    $.ajax({
        type: "POST",
        url: urlPath + urlSuffix + "?id=" + id,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfDiv).html(result.toString());
        },
        error: function () {
            //alert("ajax has error");
        }
    });
}
function ViewPaging(page, id, urlPath, div) {
    var param = {
        PageIndex: page,
        Id: id
    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}
function SaveSchedule(page, idDepartment, idClassSession, idSubject, urlPath, div) {
    var param = {
        PageIndex: page,
        IdDepartment: idDepartment,
        IdClassSession: idClassSession,
        IdSubject: idSubject
    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}
function ShowStudentAdmin(idClass, idSubject, urlPath, div) {
    var param = {
        IdClass: idClass,
        IdSubject: idSubject

    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}

function ShowStudent(page, idStudent, idClass, urlPath, div) {
    var param = {
        PageIndex: page,
        IdStudent: idStudent,
        IdClass: idClass

    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $('#ListStudentMark').show("slow");
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}


function SearchStudent(page, name, idClass, urlPath, div) {
    var param = {
        PageIndex: page,
        Name: name,
        IdClass: idClass

    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $('#ListStudentMark').hide("slow");
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}

function EditMark(studentStudentClassId, subjectId, urlPath, div) {
    var param = {
        StudentStudentClassId: studentStudentClassId,
        SubjectId: subjectId
    };
    var jsonParams = $.toJSON(param);
    $.ajax({
        type: "POST",
        data: jsonParams,
        url: urlPath,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + div).html(result.toString());

        },
        error: function () {
            //alert("ajax has error");
        }
    });
}

function ViewSubjectAjax(id, urlPath, idOfDiv) {
    $.ajax({
        type: "POST",
        url: urlPath,
        data: id,
        dataType: "html",
        contentType: "application/json",
        success: function (result) {
            $("#" + idOfDiv).html(result.toString());
        },
        error: function () {
            ////alert("ajax has error");
        }
    });
}








    



